/**
 * 
 */
package br.com.skynix.tcmc.controller.configuracao.financeiro.despesas;

import java.util.List;

import javax.annotation.Resource;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

import org.springframework.stereotype.Controller;

import br.com.skynix.tcmc.base.managedbeans.AbstractCRUDManagedBean;
import br.com.skynix.tcmc.base.spring.IServiceAuditavel;
import br.com.skynix.tcmc.model.financeiro.Despesa;
import br.com.skynix.tcmc.model.financeiro.Operacao;
import br.com.skynix.tcmc.service.configuracao.financeiro.despesas.DespesaService;
import br.com.skynix.tcmc.service.configuracao.financeiro.operacoes.OperacaoService;

/**
 * @author davi
 * 
 */
@ManagedBean
@RequestScoped
@Controller
public class DespesaMB extends AbstractCRUDManagedBean<Despesa> {
	@Resource
	private DespesaService despesaService;

	@Resource
	private OperacaoService operacaoService;

	public DespesaMB() {
		setModeloPesquisa(new Despesa());
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * br.com.skynix.tcmc.base.managedbeans.AbstractCRUDManagedBean#getService()
	 */
	@Override
	protected IServiceAuditavel<Despesa> getService() {
		return despesaService;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see br.com.skynix.tcmc.base.managedbeans.AbstractCRUDManagedBean#
	 * getPathParaModuloCRUD()
	 */
	@Override
	protected String getPathParaModuloCRUD() {
		return formatPath("configuracao/financeiro/despesas/despesa_crud_view");
	}

	public List<Operacao> getListaOperacao() {
		return operacaoService.listarTodos(getModeloEdicao().getEmpresa());
	}
}
